HAL TIM control functions migration ¶
This section provides information about the HAL TIM control functions migration.
HAL TIM base init function ¶
|
HAL1 |
HAL2 |
|
|---|---|---|
|
Initialization mode |
|
|
HAL TIM PWM init function ¶
|
HAL1 |
HAL2 |
|
|---|---|---|
|
Initialization mode |
|
|
HAL TIM Output compare init function ¶
|
HAL1 |
HAL2 |
|
|---|---|---|
|
Initialization mode |
|
|
HAL TIM input capture init function ¶
|
HAL1 |
HAL2 |
|
|---|---|---|
|
Initialization mode |
|
|
HAL TIM one pulse init function ¶
|
HAL1 |
HAL2 |
|
|---|---|---|
|
Initialization mode |
|
|
HAL TIM encoder initialization function ¶
|
HAL1 |
HAL2 |
|
|---|---|---|
|
Initialization mode |
|
|
HAL TIM hall sensor initialization function ¶
|
HAL1 |
HAL2 |
|
|---|---|---|
|
Initialization mode |
|
|
HAL TIM get active channel function ¶
HAL_TIM_GetActiveChannel function is used to determine which channel of a timer is currently active. This function is particularly useful in interrupt service routines (ISRs) or callback functions where you need to handle different timer channels distinctly.
|
Function |
HAL1 |
HAL2 |
|---|---|---|
|
HAL_TIM_GetActiveChannel |
Removed because the channel is added as an argument for each callback function which depends on the channel. |
|
|
Example |
|
|
HAL TIMEx get channel state function ¶
|
HAL1 |
HAL2 |
|---|---|
HAL_TIM_ChannelStateTypeDef HAL_TIMEx_GetChannelNState(const TIM_HandleTypeDef *htim, uint32_t ChannelN);
|
hal_tim_channel_state_t HAL_TIM_GetChannelState(const hal_tim_handle_t *htim, hal_tim_channel_t channel);
|
HAL TIM IC channel configuration function ¶
|
HAL1 |
HAL2 |
|
|---|---|---|
|
channel configuration function |
|
|
HAL TIM commutation event functions ¶
|
HAL1 |
HAL2 |
|
|---|---|---|
|
Polling mode |
|
|
|
Interrupt mode |
|
|
|
DMA mode |
|
|
Note
In HAL1, the function
HAL_TIMEx_ConfigCommutEvent/IT/DMA(TIM_HandleTypeDef *htim, uint32_t InputTrigger, uint32_t CommutationSource)
requires three arguments. When the
CommutationSource
is set to
TIM_COMMUTATION_SOFTWARE
, the
InputTrigger
must be
TIM_TS_NONE
.
In HAL2, the implementation changes to
HAL_TIM_EnableCommutation, which no longer requires specifying the
InputTrigger
for any selected
commutation_source. Consequently,
TIM_TS_NONE
is removed from HAL2..
HAL TIM master mode configuration ¶
|
HAL1 |
HAL2 |
|
|---|---|---|
|
Master Mode Configuration |
|
|
HAL TIM TI1 input configuration ¶
|
HAL1 |
HAL2 |
|
|---|---|---|
|
TI1 Input Configuration |
|
|
HAL TIMEx TI selection function ¶
HAL1
HAL2
HAL_StatusTypeDef HAL_TIMEx_TISelection(TIM_HandleTypeDef *htim, uint32_t TISelection, uint32_t Channel);hal_status_t HAL_TIM_IC_SetChannelSource(hal_tim_handle_t *htim, hal_tim_channel_t channel, hal_tim_channel_src_t channel_src);
HAL TIM OCREF clear configuration ¶
|
HAL1 |
HAL2 |
|
|---|---|---|
|
OCREF Clear Configuration |
|
|
HAL TIM OC pulse on compare configuration ¶
|
HAL1 |
HAL2 |
|---|---|
HAL_StatusTypeDef HAL_TIMEx_OC_ConfigPulseOnCompare(TIM_HandleTypeDef *htim, uint32_t PulseWidthPrescaler, uint32_t PulseWidth);
|
hal_status_t HAL_TIM_OC_SetPulseGenerator(hal_tim_handle_t *htim, const hal_tim_pulse_generator_config_t *p_config);
|
HAL TIM One pulse configuration ¶
|
HAL1 |
HAL2 |
|
|---|---|---|
|
One Pulse Configuration |
|
|
HAL TIM encoder index configuration functions ¶
|
HAL1 |
HAL2 |
|
|---|---|---|
|
Configuration mode |
|
|
HAL TIM enable disable encoder first index functions ¶
|
HAL1 |
HAL2 |
|
|---|---|---|
|
Configuration mode |
|
|
HAL TIM enable encoder index function ¶
|
HAL1 |
HAL2 |
|---|---|
HAL_StatusTypeDef HAL_TIMEx_EnableEncoderIndex(TIM_HandleTypeDef *htim);
|
hal_status_t HAL_TIM_EnableEncoderIndex(hal_tim_handle_t *htim);
|
HAL TIM disable encoder index function ¶
|
HAL1 |
HAL2 |
|---|---|
HAL_StatusTypeDef HAL_TIMEx_DisableEncoderIndex(TIM_HandleTypeDef *htim);
|
hal_status_t HAL_TIM_DisableEncoderIndex(hal_tim_handle_t *htim);
|
HAL TIM encoder index callback ¶
|
HAL1 |
HAL2 |
|---|---|
void HAL_TIMEx_EncoderIndexCallback(TIM_HandleTypeDef *htim);
|
void HAL_TIM_EncoderIndexCallback(hal_tim_handle_t *htim);
|
HAL TIM Remap Configuration function ¶
|
HAL1 |
HAL2 |
|
|---|---|---|
|
Configuration mode |
|
|
HAL TIM Output Compare Channel Configuration functions ¶
|
HAL1 |
HAL2 |
|
|---|---|---|
|
Configuration mode |
|
|
HAL TIM group channel 5 function ¶
|
HAL1 |
HAL2 |
|---|---|
HAL_StatusTypeDef HAL_TIMEx_GroupChannel5(TIM_HandleTypeDef *htim, uint32_t Channels);
|
hal_status_t HAL_TIM_OC_SetGroupChannel(hal_tim_handle_t *htim, uint32_t group);
|
HAL TIM break input arm/disarm functions ¶
|
HAL1 |
HAL2 |
|
|---|---|---|
|
Break Input Control |
|
|
HAL TIM slave configuration functions ¶
|
HAL1 |
HAL2 |
|
|---|---|---|
|
Blocking Mode |
|
|
|
Interrupt Mode |
|
|
HAL TIM enable slave mode preload functions ¶
|
HAL1 |
HAL2 |
|---|---|
HAL_StatusTypeDef HAL_TIMEx_ConfigSlaveModePreload(TIM_HandleTypeDef *htim, uint32_t Source);
HAL_StatusTypeDef HAL_TIMEx_EnableSlaveModePreload(TIM_HandleTypeDef *htim);
|
hal_status_t HAL_TIM_EnableSlaveModePreload(hal_tim_handle_t *htim, const hal_tim_slave_mode_preload_src_t preload_src);
|
HAL TIM disable slave mode preload functions ¶
|
HAL1 |
HAL2 |
|---|---|
HAL_StatusTypeDef HAL_TIMEx_DisableSlaveModePreload(TIM_HandleTypeDef *htim);
|
hal_status_t HAL_TIM_DisableSlaveModePreload(hal_tim_handle_t *htim);
|
HAL TIM SW event generation ¶
|
HAL1 |
HAL2 |
|---|---|
HAL_StatusTypeDef HAL_TIM_GenerateEvent(TIM_HandleTypeDef *htim,
uint32_t EventSource);
|
hal_status_t HAL_TIM_GenerateEvent(hal_tim_handle_t *htim,
hal_tim_sw_event_id_t sw_event_id);
|
HAL TIMEx enable HSE32 functions ¶
|
HAL1 |
HAL2 |
|
|---|---|---|
|
Configuration |
|
Note to disable HSE32 you need to select another input source. |
HAL TIMEx config break dead time functions ¶
|
HAL1 |
HAL2 |
|
|---|---|---|
|
Configuration |
|
|
HAL TIMEx config break input source functions ¶
|
HAL1 |
HAL2 |
|
|---|---|---|
|
Initialization mode |
|
|
HAL TIMEx config dead time functions ¶
|
HAL1 |
HAL2 |
|
|---|---|---|
|
Initialization mode |
|
|
HAL TIM enable deadtime preload function ¶
|
HAL1 |
HAL2 |
|---|---|
HAL_StatusTypeDef HAL_TIMEx_EnableDeadTimePreload(TIM_HandleTypeDef *htim);
|
hal_status_t HAL_TIM_EnableDeadtimePreload(hal_tim_handle_t *htim);
|
HAL TIM disable deadtime preload function ¶
|
HAL1 |
HAL2 |
|---|---|
HAL_StatusTypeDef HAL_TIMEx_DisableDeadTimePreload(TIM_HandleTypeDef *htim);
|
hal_status_t HAL_TIM_DisableDeadtimePreload(hal_tim_handle_t *htim);
|
HAL TIM enable asymmetrical deadtime function ¶
|
HAL1 |
HAL2 |
|---|---|
HAL_StatusTypeDef HAL_TIMEx_EnableAsymmetricalDeadTime(TIM_HandleTypeDef *htim);
|
hal_status_t HAL_TIM_EnableAsymmetricalDeadtime(hal_tim_handle_t *htim);
|
HAL TIM disable asymmetrical deadtime function ¶
|
HAL1 |
HAL2 |
|---|---|
HAL_StatusTypeDef HAL_TIMEx_DisableAsymmetricalDeadTime(TIM_HandleTypeDef *htim);
|
hal_status_t HAL_TIM_DisableAsymmetricalDeadtime(hal_tim_handle_t *htim);
|
HAL TIM enable dithering function ¶
|
HAL1 |
HAL2 |
|---|---|
HAL_StatusTypeDef HAL_TIMEx_DitheringEnable(TIM_HandleTypeDef *htim);
|
hal_status_t HAL_TIM_EnableDithering(hal_tim_handle_t *htim);
|
HAL TIM disable dithering function ¶
|
HAL1 |
HAL2 |
|---|---|
HAL_StatusTypeDef HAL_TIMEx_DitheringDisable(TIM_HandleTypeDef *htim);
|
hal_status_t HAL_TIM_DisableDithering(hal_tim_handle_t *htim);
|
HAL TIM PWM channel configuration functions ¶
|
HAL1 |
HAL2 |
|
|---|---|---|
|
Configuration mode |
|
|
HAL TIM read captured value function ¶
|
HAL1 |
HAL2 |
|---|---|
uint32_t HAL_TIM_ReadCapturedValue(const TIM_HandleTypeDef *htim,
uint32_t Channel);
|
uint32_t HAL_TIM_IC_ReadChannelCapturedValue(const hal_tim_handle_t *htim,
hal_tim_channel_t channel)
|
HAL TIM config clock source ¶
|
HAL1 |
HAL2 |
|---|---|
HAL_StatusTypeDef HAL_TIM_ConfigClockSource(TIM_HandleTypeDef *htim,
const TIM_ClockConfigTypeDef *sClockSourceConfig);
|
hal_status_t HAL_TIM_SetClockSource(hal_tim_handle_t *htim,
const hal_tim_clock_sel_t *p_clk_sel);
|